home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / msg / putreplymsg.c < prev    next >
C/C++ Source or Header  |  2001-05-12  |  722b  |  37 lines

  1.  
  2. #include "tek/msg.h"
  3. #include "tek/kn/exec.h"
  4.  
  5. /* 
  6. **    TEKlib
  7. **    (C) 2001 TEK neoscientists
  8. **    all rights reserved.
  9. **
  10. **    TVOID TPutReplyMsg(TPORT *msgport, TPORT *replyport, TAPTR msg)
  11. **
  12. **    put msg to msgport, with a reply expected at replyport, reliable
  13. **
  14. **    replyport may be NULL
  15. **
  16. */
  17.  
  18. TVOID TPutReplyMsg(TPORT *msgport, TPORT *replyport, TAPTR mem)
  19. {
  20.     if (msgport && mem)
  21.     {
  22.         TMSG *msg = ((TMSG *) mem) - 1;
  23.  
  24.         msg->replyport = replyport;
  25.         msg->sender = TNULL;                /* sender is local address space */
  26.  
  27.         msg->status = TMSG_STATUS_SENT | TMSG_STATUS_PENDING;
  28.  
  29.         kn_lock(&msgport->lock);
  30.  
  31.         TAddTail(&msgport->msglist, (TNODE *) msg);
  32.         TSignal(msgport->sigtask, msgport->signal);
  33.  
  34.         kn_unlock(&msgport->lock);
  35.     }
  36. }
  37.